-----------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  D:\Ellen\Dropbox\Pajaro_AgInnovation\Submission\JAERE\Replication_Code\Log\D
> inD_annual_well_log.log
  log type:  text
 opened on:  29 Nov 2023, 14:11:21

. 
. 
. *SELECT DATASET
. global dataset 2         

. global quarterly "Data\Well_Clean_20230627.dta"

. global yearrun "Data\Well_clean_yearrun_20230627.dta"

. 
. if $dataset == 1 use $quarterly, clear

. if $dataset == 2 use $yearrun, clear

. 
. ********************************************************************************
. *TABLE 9: ANNUAL EXTRACTION DIFF IN DIFF AT WELL LEVEL
. ********************************************************************************
. *Balance the panel
. bysort sitenum: gen ntime = [_N]

. sum ntime

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       ntime |     12,240    13.97304     2.46162          1         15

. keep if ntime==`r(max)'
(2,535 observations deleted)

. 
. *Drop 2010
. drop if year_run==5 
(647 observations deleted)

. drop if year_run >10
(3,235 observations deleted)

. 
. eststo clear

. *Column 1: No FE
. eststo: reg extraction treatment post inside if year_run <11, cluster(parcelnum)

Linear regression                               Number of obs     =      5,823
                                                F(3, 574)         =       9.06
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0346
                                                Root MSE          =     78.237

                            (Std. Err. adjusted for 575 clusters in parcelnum)
------------------------------------------------------------------------------
             |               Robust
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   treatment |  -21.31396   10.23956    -2.08   0.038    -41.42554   -1.202388
        post |  -4.329627   1.368087    -3.16   0.002    -7.016695    -1.64256
      inside |   56.74528   14.66833     3.87   0.000     27.93514    85.55543
       _cons |   55.93595   3.215995    17.39   0.000      49.6194     62.2525
------------------------------------------------------------------------------
(est1 stored)

.         estadd local wellFE " "

added macro:
             e(wellFE) : " "

.         estadd local timeFE " "

added macro:
             e(timeFE) : " "

.         estadd local controls " "

added macro:
           e(controls) : " "

. *Column 2: Add well FE
. eststo: xtreg extraction treatment post if year_run <11, fe cluster(parcelnum) 

Fixed-effects (within) regression               Number of obs      =      5823
Group variable: sitenum                         Number of groups   =       647

R-sq:  within  = 0.0200                         Obs per group: min =         9
       between = 0.0376                                        avg =       9.0
       overall = 0.0040                                        max =         9

                                                F(2,574)           =      8.20
corr(u_i, Xb)  = -0.1503                        Prob > F           =    0.0003

                            (Std. Err. adjusted for 575 clusters in parcelnum)
------------------------------------------------------------------------------
             |               Robust
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   treatment |  -21.31396   10.23868    -2.08   0.038    -41.42381   -1.204116
        post |  -4.329627    1.36797    -3.17   0.002    -7.016464    -1.64279
       _cons |   62.16302   .9167554    67.81   0.000     60.36242    63.96363
-------------+----------------------------------------------------------------
     sigma_u |  73.236519
     sigma_e |  34.800637
         rho |  .81579548   (fraction of variance due to u_i)
------------------------------------------------------------------------------
(est2 stored)

.         estadd local wellFE " \checkmark  "

added macro:
             e(wellFE) : " \checkmark  "

.         estadd local timeFE " "

added macro:
             e(timeFE) : " "

.         estadd local controls " "

added macro:
           e(controls) : " "

. *Column 3: Add year FE
. eststo: xtreg extraction treatment i.year_run if year_run <11, fe cluster(parcelnum)

Fixed-effects (within) regression               Number of obs      =      5823
Group variable: sitenum                         Number of groups   =       647

R-sq:  within  = 0.0346                         Obs per group: min =         9
       between = 0.0376                                        avg =       9.0
       overall = 0.0006                                        max =         9

                                                F(9,574)           =     13.87
corr(u_i, Xb)  = -0.1247                        Prob > F           =    0.0000

                            (Std. Err. adjusted for 575 clusters in parcelnum)
------------------------------------------------------------------------------
             |               Robust
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   treatment |  -21.31396   10.24484    -2.08   0.038    -41.43592   -1.192012
             |
    year_run |
          2  |   9.210546   1.594828     5.78   0.000     6.078136    12.34296
          3  |   7.905114   1.508698     5.24   0.000     4.941872    10.86836
          4  |   4.165383   1.653171     2.52   0.012     .9183805    7.412386
          6  |  -5.894324   1.490417    -3.95   0.000     -8.82166   -2.966988
          7  |   1.720882   1.842978     0.93   0.351    -1.898922    5.340686
          8  |   4.227566   1.860374     2.27   0.023     .5735949    7.881538
          9  |   6.369436   2.034605     3.13   0.002     2.373258    10.36561
         10  |  -1.470394   1.765061    -0.83   0.405    -4.937159    1.996372
             |
       _cons |   56.84276   1.286604    44.18   0.000     54.31574    59.36979
-------------+----------------------------------------------------------------
     sigma_u |  73.236519
     sigma_e |  34.562789
         rho |  .81784771   (fraction of variance due to u_i)
------------------------------------------------------------------------------
(est3 stored)

.         estadd local wellFE " \checkmark  "

added macro:
             e(wellFE) : " \checkmark  "

.         estadd local timeFE " \checkmark  "

added macro:
             e(timeFE) : " \checkmark  "

.         estadd local controls " "

added macro:
           e(controls) : " "

. *Column 4: Add county-year FE
. eststo: xtreg extraction treatment i.year_run#i.county if year_run <11, fe cluster(parc
> elnum)
note: 10.year_run#2.county_code omitted because of collinearity

Fixed-effects (within) regression               Number of obs      =      5823
Group variable: sitenum                         Number of groups   =       647

R-sq:  within  = 0.0359                         Obs per group: min =         9
       between = 0.0378                                        avg =       9.0
       overall = 0.0003                                        max =         9

                                                F(17,574)          =      7.98
corr(u_i, Xb)  = -0.1177                        Prob > F           =    0.0000

                                    (Std. Err. adjusted for 575 clusters in parcelnum)
--------------------------------------------------------------------------------------
                     |               Robust
          extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
           treatment |  -20.28593   9.918595    -2.05   0.041    -39.76709   -.8047607
                     |
year_run#county_code |
                1 2  |   1.146884   1.894947     0.61   0.545    -2.574992     4.86876
                2 1  |    12.5326   3.414255     3.67   0.000     5.826647    19.23856
                2 2  |    8.58619   2.149265     3.99   0.000     4.364806    12.80757
                3 1  |   10.55422   3.384659     3.12   0.002     3.906391    17.20204
                3 2  |   7.639562   1.959524     3.90   0.000      3.79085    11.48827
                4 1  |   6.268329   3.732594     1.68   0.094     -1.06288    13.59954
                4 2  |   4.191029   1.732893     2.42   0.016     .7874442    7.594613
                6 1  |  -8.091027   3.502369    -2.31   0.021    -14.97005   -1.212006
                6 2  |  -3.749175   1.387246    -2.70   0.007    -6.473872   -1.024479
                7 1  |   2.428599    4.55701     0.53   0.594     -6.52185    11.37905
                7 2  |   2.317464   1.806029     1.28   0.200    -1.229766    5.864695
                8 1  |   3.939799   4.345066     0.91   0.365    -4.594368    12.47397
                8 2  |   5.354917   1.788135     2.99   0.003     1.842832    8.867002
                9 1  |   7.031595   4.940992     1.42   0.155    -2.673034    16.73622
                9 2  |    6.99031   1.602888     4.36   0.000      3.84207    10.13855
               10 1  |  -2.401556   4.110686    -0.58   0.559    -10.47538    5.672265
               10 2  |          0  (omitted)
                     |
               _cons |   56.09472   1.526766    36.74   0.000     53.09599    59.09345
---------------------+----------------------------------------------------------------
             sigma_u |  73.195383
             sigma_e |  34.566823
                 rho |  .81764546   (fraction of variance due to u_i)
--------------------------------------------------------------------------------------
(est4 stored)

.         estadd local wellFE " \checkmark  "

added macro:
             e(wellFE) : " \checkmark  "

.         estadd local timeFE " "

added macro:
             e(timeFE) : " "

.         estadd local controls " \checkmark  "

added macro:
           e(controls) : " \checkmark  "

. esttab using "Tables\Extraction_DinD_well_$outputdate.tex", label replace ///
>         se star(* .10 ** .05 *** .01) ///
>         addnote(Table reports results from diff-in-diff regression. Standard errors are
>  clustered at the parcel level.) ///
>         keep(_cons post treatment inside) ///
>         scalars("wellFE Parcel FE" "timeFE Year FE" "controls County-Year FE") ///
>         cells(b(star fmt(2)) se(par fmt(2)))
(output written to Tables\Extraction_DinD_well_20231125.tex)

. eststo clear

. 
. log close
      name:  <unnamed>
       log:  D:\Ellen\Dropbox\Pajaro_AgInnovation\Submission\JAERE\Replication_Code\Log\D
> inD_annual_well_log.log
  log type:  text
 closed on:  29 Nov 2023, 14:11:22
-----------------------------------------------------------------------------------------
